﻿using System;
using System.Collections.Generic;
using System.Text;
using WordService.Business.IBLL;
using WordService.Data.IDAL;
using WordService.Data;
using WordService.Model;

namespace WordService.Business.BLL
{
    public sealed class KeywordBLL:IKeywordBLL
    {
        private IKeywordDAL keywordDAL = DALManager.CreateKeywordDAL();

        public Keyword CreateKeyword(Keyword keyword)
        {
            Decimal rightRate = Decimal.Parse(keyword.RightRate.ToString());
            keyword.ID = keywordDAL.InsertKeyword(keyword.Name, keyword.Count, rightRate, keyword.Article.ID, keyword.TotalCount);
            return keyword;
        }

        public Boolean CreateKeywords(IList<Keyword> keywords)
        {
            throw new NotImplementedException();
        }

        public Boolean CheckKeyword(Keyword keyword)
        {
            throw new NotImplementedException();
        }

        public Boolean ModifyKeyword(Keyword keyword)
        {
            throw new NotImplementedException();
        }


        public IList<Keyword> QueryByCondition(string authorName, string insName, long frequency, string year)
        {
            return keywordDAL.QueryByCondition(authorName, insName, frequency, year);
        }

        public IList<Keyword> QueryAllKeywords()
        {
            return keywordDAL.QueryByCondition(null, null, 0, null);
        }
    }
}
